This Week in Perl 6, May 18 - 24, 2005

Note to self: It’s generally not a good idea to go installing Tiger on the day you return from holiday. It’s especially not a good idea to fail to check that it didn’t completely and utterly radish your Postfix configuration. And your Emacs. And the backing store for your website. And a bunch of other stuff. It’s an especially bad idea not to have backups of things like your aliases file…

Nor is it a good idea to get preoccupied with all these joys and completely forget that you should be writing the Perl 6 summary.

Ahem.

I’m very, very sorry.

So, on with the show.

This Week in perl6-compiler

Inline::Pugs

Autrijus announced the availability of Inline::Pugs. If you’ve ever wanted to mix up Perl’s 5 and 6 in one program, your prayers have been answered. Just grab Pugs and Inline and you’re set. Brian Ingerson made things even more delightfully evil:

#!perl
use pugs;
sub postfix:<!> { [*] 1..$_ }
sub sum_factorial { [+] 0..$_! }
no pugs;
print sum_factorial(3); # 21

Experimental Coroutine Support

Autrijus announced that Pugs now has an experimental implementation of coroutines. It’s almost certainly not final, but it’s good enough for exploration and feedback purposes.

Graphing Tool for PerlGuts Illustrated

Yuval Kogman asked what tool generated the “pretty diagrams” in PerlGuts Illustrated because he wanted to use it for diagrams in a forthcoming PugsGuts Illustrated. Ingy said that Gisle had hand hacked PostScript based on initial diagrams drawn on graph paper. After some discussion, the plan seems to be that Yuval will just draw diagrams, scan them, and bung them into the Pugs repository. He’ll rely on the LazyWeb to turn them into beautiful scalable graphics.

Perl Development Server

Okay everyone, repeat after me: “Juerd is a star!”

You may ask me why, and I shall tell you.

Juerd and his cosponsors, Twistspace, will make a Perl 6 development server available over the internet to any Perl 6 developers who are working on “everything that improves Perl 6 development”. If you’ve been put off working on Pugs by the hassles of getting Haskell working on your machine, or if you have the kind of bandwidth that makes svn updates a painful prospect, worry no longer. Just sign up for a development account.

There was much rejoicing and suggesting of hostnames. Rather bizarrely, there was also discussion of the etymology of “sipuli” (Finnish for “onion”, in case you were wondering).

Two Releases in One Day

Autrijus announced the release of Pugs 6.2.4. About half an hour later he announced the release of Pugs 6.2.5.

Undef Issues

Adrian Taylor thought he’d found some issues with Perl 6’s understanding of undef. It turned out that he’d found some issues with his own understanding of same.

Method/Attribute Chaining

Alex Gutteridge found some weirdness with the chaining of autogenerated attribute methods (I wonder if the same weirdness occurs with hand rolled attribute methods). So far it remains unfixed, but given the speed of Pugs development I doubt it’ll stay that way for long.

Meanwhile, in perl6-internals

Parrot as an Extension Language

Colin Adams continued to have problems using Parrot as an extension language for Eiffel. It turns out that interfacing between statically strongly typed languages and Parrot isn’t easy.

Fixing t/src/manifest.t

Dino Morelli reported problems with t/src/manifest.t and wondered how some of the failures came about. Jürgen Bömmels thought that the problem was an overzealous test–the original version of which simply ensured that version control and the MANIFEST were in sync. He provided his suggested version of a less eager, but still svn compatible test. Further discussion thrashed out the various different use cases for manifest checking.

More t/p6rules Tests

Dino Morelli posted a bunch of tests for the Perl 6 rules. Well, he did once he’d done battling his mailer’s somewhat bizarre choice of MIME type for his test files. Remember, if you’re about to attach a .t file to a message you send to the list, make sure your mailer doesn’t declare it to be an application/x-troff file–text/plain is your friend.

Then someone applied his patches.

Stressing the Hash

Leo asked for some stress and bench mark tests for hashes because he was in the process of redoing src/hash.c. Bob Rogers provided one.

In Other News, PyPy Gets an Initial Release

Leo crossposted the announcement of PyPy 0.6, a Python implementation written in Python. It’s not bootstrapping yet, but it’s getting there…

PIR Compilers Broken

Will Coleda had some problems with his TCL in PIR implementation. It turns Nick Glencross helped to track down the problems with the snippet he posted. I’m not sure whether his fix is extendable to work with the real ParTCL.

MMD

While working on mod_parrot, Jeff Horwitz ran into an issue with Multi Method Dispatch (MMD). In particularly he didn’t seem to be able to declare a multimethod that accepted an arbitrary PMC. Leo asked for a .t file so he could explore the issue further, which Jeff provided.

State of ParTCL

Will Coleda posted a summary of the current state of ParTCL. By the sound of things, it’s getting there.

Meanwhile, in perl6-language

Virtual Methods

Whilst noting that Perl 6 doesn’t really need to be able to declare methods as virtual in the same way as C++, since one can simply use the handy ... to do the job, Aaron Sherman noted that there was a case for something similar when declaring “stub” methods that Roles could override. The idea being that you would implement an initial behaviour that you could further decorate by a Role. Except, as Luke pointed out, the Roles system as currently defined treats all such methods as overridable.

Aaron wasn’t sure that this was such a good idea and produced code to illustrate why.

Default Precedence of User-Defined infix ops

Ingo Blechschmidt pointed out that user defined infix operators work in Pugs now. He wondered what their default precedence should be and how to define the precedence explicitly. Luke came forth with an answer, Sam Vilain asked an evil question, and Damian Conway suggested that, given how drastically precedence weirdness can mess with a programmer’s head, there shouldn’t be a default precedence at all, and if there were, it should be looser than infix:<+>. I agree with Damian.

1,(2,3),4)[2]

Argh! My head hurts!

However, if you’re not sure how context works in Perl 6, Juerd provided a really good summary later in the thread

Reduce Metaoperator on an Empty List

Matt Fowles wondered how the shiny new reduce metaoperator worked given an empty list. Various suggestions were forthcoming, but I lean towards Randal’s inject solution–but I’m a Smalltalk fan, so there’s no surprise there. Personally, I reckon that the metaoperator version should just return undef given an empty list. If you want anything clever you should eschew the syntactic sugar and use inject or something like it. It seems that the consensus leans towards using an identity attribute on the infix operator.

BTW, what happens when you apply [/] to a list with one element?

Complex Arithmetic

Doing complex arithmetic right in a programming language is tricky. Edward Cherlin wondered if Perl 6 should follow what seems to be the consensus among programming languages that care about this sort of thing and use the shared definitions used by APL, Common LISP, and Ada. Luke thought it might be better to leave this to C6PAN. (This is the discerning language designer’s equivalent to paying no attention to the man behind the curtain methinks).

Syntax for Specifying Role Parameters

Ingo Blechschmidt wondered if the syntax for specifying role parameters should be the same as the standard subroutine signature syntax (with a slightly modified proposed meaning for :). Thomas Sandlaß had some related suggestions to add. Nothing from any of the design team yet.

./method

Martin Kuel can’t make himself like ./method as a shortcut for $whatever_you_call_self_this_week.method. Frankly, I can’t blame him, but then I continue to think that the originally specified semantics of .method (calls method on $_, whether in a method or a sub, or anywhere else for that matter) are fine.

uniq

Ingo wondered why uniq wasn’t in the current draft of Synopsis 29. He also wondered if its default comparator should be =:=. It turns out that there’s rather more to the semantics of uniq than you’d expect; Damian’s “hyper correct” implementation blew my mind.

s/.../{ $junction }/

Junctions? In substitutions? What is Ingo thinking? Warnock applies.

Argument Type Checking

Joshua Gatcomb sought reassurance that

sub foo (Int $bar) { say $bar }
foo 'hello';

would do the right thing, namely throw an exception. Luke reassured him.

How to Create a New Meta Operator

Ingo’s obviously been in a very wondering mood this week. This time he wondered if he could create a new meta operator in the obvious (to anyone who’s read Apocalypse 12 carefully) way. What? You’ve not read Apocalypse 12 carefully? Shame on you! Like this:

sub infix_circumfix_meta_operator:{'->', '<-'} (Code &op, $left, $right)
{ op $left + 1, $right + 1 }

say 2 ->+<- 3; # 7

Luke thought so, but threw in his own question about how we’d specify meta operators that only work on particular classes of operators.

How to Invoke a Method Reference

Continuing to mine his wondering vein, Ingo asked how to invoke method references. Juerd thought it’d work pretty much as it does in Perl 5.

Junctive and Higher-Order Types

Sam Vilain’s question about converting a Haskellish chunk of code into Perl 6 went Warnocked.

foo(1: 2: 3: 4:)

I was so tempted to use “Multimethod colonoscopy” as the heading for this section. Aren’t you glad I resisted?

Autrijus has started to implement multi-level invocants in MMDs. He asked a bunch of sanity check questions before proceeding. Luke and Damian provided the sanity.

Lazy Context

Borrowing Ingo’s wondering hat, Yuval Kogman had questions about the semantics of laziness. Laziness is one of many features of Perl 6 that’s reasonably easy to understand from the point of view of the user, but which is a big old can of worms from the point of view of the implementer. I think I understood Yuval’s proposed semantics/implementation, but it stumps me when it comes to summarizing it. People seemed to like it though.

Declaration of my() Variables Using Symbolic Referentiation

Snatching back his wondering hat, Ingo asked a question I didn’t understand about declaring my variables using symbolic referentiation. Frankly, I don’t even understand the subject. The consensus of those responding seemed to be that what Ingo wanted to do was pretty silly in the first place.

Explicit Laws about Whitespace in Rules

Jeff “japhy” Pinyan wanted to know what the rules were about permitting whitespace in rules. In particular, was it legal to write \c [CHARACTER NAME], or must he write \c[CHARACTER NAME]. Damian reckons only the second is legal.

And We’re Done

That’s it for another week. Tune in at the same time next week when Mr. Fowles will entertain you all with his interpretation of the coming week’s events. I’ll be back here the week after that.

If you find these summaries useful or enjoyable, please consider contributing to the Perl Foundation to help support the development of Perl.

Or, you can check out my website. Maybe now that I’m back writing stuff I’ll start updating it. There are also vaguely pretty photos by me.

Tags

Feedback

Something wrong with this article? Help us out by opening an issue or pull request on GitHub